﻿using System;
using System.Text;
using System.IO;

namespace hieunv.Logs
{
	public class Logs
	{
		public const string LOGS_FILE = "Logs.txt";
		public static void WriteLog(Exception exc)
		{
			using (StreamWriter sw = File.AppendText(LOGS_FILE))
			{
				sw.WriteLine(string.Format("[{0:dd/MM/yyyy hh:mm:ss tt}]\n{1}\n{2}", DateTime.Now, exc.StackTrace, exc.Message));
			}			
		}
		public static void WriteLog(string message)
		{
			using (StreamWriter sw = File.AppendText(LOGS_FILE))
			{
				sw.WriteLine(string.Format("[{0:dd/MM/yyyy hh:mm:ss tt}] {1}", DateTime.Now, message));
			}
		}
	}
}
